package card

import (
	"context"
	"hotgo/internal/service"

	"hotgo/api/api/card/v1"
)

func (c *ControllerV1) CardActive(ctx context.Context, req *v1.CardActiveReq) (res *v1.CardActiveRes, err error) {
	r, e := service.Card().ActiveCard(ctx, &req.CardActiveInp)
	if e != nil {
		return nil, e
	}
	res = &v1.CardActiveRes{
		CardActiveModel: r,
	}
	return
}

func (c *ControllerV1) CardInfo(ctx context.Context, req *v1.CardInfoReq) (res *v1.CardInfoRes, err error) {
	r, e := service.Card().CardInfoByQrCode(ctx, &req.CardInfoInp)
	if e != nil {
		return nil, e
	}
	res = &v1.CardInfoRes{
		CardInfoByQrCodeModel: r,
	}
	return
}
